import 'package:get/get.dart';
import 'package:ty_smart_watch/bean/sport_desc_bean.dart';
import 'package:ty_smart_watch/bean/sport_recorder_bean.dart';
import 'package:ty_smart_watch/common/images_url.dart';

class SportController extends GetxController {
  ///运动页首页网格数据
  var sportList = <SportRecorderBean>[
    SportRecorderBean(
        0x00, 0xFF2BC6FF, SPORT_TYPE_OTHER, "其他", SportBean(0, 0, 0, 0, 0, 0, 0, "0", 0)),
    SportRecorderBean(
        0x01, 0xFFFFBB45, SPORT_TYPE_NORMAL, "日常", SportBean(0, 0, 0, 0, 0, 0, 0, "0", 0)),
    SportRecorderBean(
        0x02, 0xFFFF5400, SPORT_TYPE_RUN, "跑步", SportBean(0, 0, 0, 0, 0, 0, 0, "0", 0)),
    SportRecorderBean(
        0x03, 0xFF1872BF, SPORT_TYPE_BIKE, "骑行", SportBean(0, 0, 0, 0, 0, 0, 0, "0", 0)),
    SportRecorderBean(
        0x04, 0xFFFF47DA, SPORT_TYPE_JUMP, "跳绳", SportBean(0, 0, 0, 0, 0, 0, 0, "0", 0)),
    SportRecorderBean(
        0x05, 0xFF00AAEB, SPORT_TYPE_SWIM, "游泳", SportBean(0, 0, 0, 0, 0, 0, 0, "0", 0)),
    SportRecorderBean(
        0x06, 0xFF1872BF, SPORT_TYPE_YUMAOQIU, "羽毛球", SportBean(0, 0, 0, 0, 0, 0, 0, "0", 0)),
    SportRecorderBean(
        0x07, 0xFFFF712B, SPORT_TYPE_PINGPANGQIU, "乒乓球", SportBean(0, 0, 0, 0, 0, 0, 0, "0", 0)),
    SportRecorderBean(
        0x08, 0xFF00D9A8, SPORT_TYPE_WANGQIU, "网球", SportBean(0, 0, 0, 0, 0, 0, 0, "0", 0)),
    SportRecorderBean(
        0x09, 0xFF00A446, SPORT_TYPE_MOUNT, "排山", SportBean(0, 0, 0, 0, 0, 0, 0, "0", 0)),
    SportRecorderBean(
        0x0A, 0xFF00C498, SPORT_TYPE_WALK, "徒步", SportBean(0, 0, 0, 0, 0, 0, 0, "0", 0)),
    SportRecorderBean(
        0x0B, 0xFFFF72E3, SPORT_TYPE_BASKETBALL, "篮球", SportBean(0, 0, 0, 0, 0, 0, 0, "0", 0)),
    SportRecorderBean(
        0x0C, 0xFF5C46FF, SPORT_TYPE_FOOTBALL, "足球", SportBean(0, 0, 0, 0, 0, 0, 0, "0", 0)),
    SportRecorderBean(
        0x0D, 0xFF2BC6FF, SPORT_TYPE_BANGQIU, "棒球", SportBean(0, 0, 0, 0, 0, 0, 0, "0", 0)),
    SportRecorderBean(
        0x0E, 0xFF2BC6FF, SPORT_TYPE_PAIQIU, "排球", SportBean(0, 0, 0, 0, 0, 0, 0, "0", 0)),
    SportRecorderBean(
        0x0F, 0xFFFFBB45, SPORT_TYPE_BANQIU, "板球", SportBean(0, 0, 0, 0, 0, 0, 0, "0", 0)),
    SportRecorderBean(
        0x10, 0xFF07B953, SPORT_TYPE_GANLANQIU, "橄榄球", SportBean(0, 0, 0, 0, 0, 0, 0, "0", 0)),
    SportRecorderBean(
        0x11, 0xFF1872BF, SPORT_TYPE_QVGUNQIU, "曲棍球", SportBean(0, 0, 0, 0, 0, 0, 0, "0", 0)),
    SportRecorderBean(
        0x12, 0xFFFF712B, SPORT_TYPE_DANCE, "跳舞", SportBean(0, 0, 0, 0, 0, 0, 0, "0", 0)),
    SportRecorderBean(
        0x13, 0xFF00D9A8, SPORT_TYPE_DONGGANDANCHE, "动感单车", SportBean(0, 0, 0, 0, 0, 0, 0, "0", 0)),
    SportRecorderBean(
        0x14, 0xFFFF47DA, SPORT_TYPE_YOGA, "瑜伽", SportBean(0, 0, 0, 0, 0, 0, 0, "0", 0)),
    SportRecorderBean(
        0x15, 0xFFFFA200, SPORT_TYPE_YANGWOQIZUO, "仰卧起坐", SportBean(0, 0, 0, 0, 0, 0, 0, "0", 0)),
    SportRecorderBean(
        0x16, 0xFF5C46FF, SPORT_TYPE_PAOBUJI, "跑步机", SportBean(0, 0, 0, 0, 0, 0, 0, "0", 0)),
    SportRecorderBean(
        0x17, 0xFF00AAE8, SPORT_TYPE_TICAO, "体操", SportBean(0, 0, 0, 0, 0, 0, 0, "0", 0)),
    SportRecorderBean(
        0x18, 0xFFFFA200, SPORT_TYPE_BOAT, "划船", SportBean(0, 0, 0, 0, 0, 0, 0, "0", 0)),
    SportRecorderBean(
        0x19, 0xFF00A446, SPORT_TYPE_KAIHETIAO, "开合跳", SportBean(0, 0, 0, 0, 0, 0, 0, "0", 0)),
    SportRecorderBean(
        0x1A, 0xFF1872BF, SPORT_TYPE_FREE, "自由训练", SportBean(0, 0, 0, 0, 0, 0, 0, "0", 0)),
    SportRecorderBean(
        0x1B, 0xFFFF712B, SPORT_TYPE_JUZHONG, "举重", SportBean(0, 0, 0, 0, 0, 0, 0, "0", 0)),
    SportRecorderBean(
        0x1C, 0xFF5C46FF, SPORT_TYPE_PANYAN, "攀岩", SportBean(0, 0, 0, 0, 0, 0, 0, "0", 0)),
  ].obs;

  ///更新运动康健页网格数据
  updateData(List<SportBean> list) {
    for (var item in list) {
      var targetItem = sportList.firstWhere((element) => element.id == item.type);
      targetItem.bean = item;
    }
    sportList.refresh();
  }

  ///运动详情页网格数据
  var sportDetailGridList = <SportDescBean>[
    SportDescBean(SPORT_CHILD_CAL, "总消耗", "11.5", "千卡"),
    SportDescBean(SPORT_CHILD_DURATION, "总用时", "11:22:33", ""),
    SportDescBean(SPORT_CHILD_HEART, "平均心率", "94", "次/分"),
    SportDescBean(SPORT_CHILD_COUNT, "总天数", "11", "天"),
  ].obs;

  ///更新运动详情页网格数据
  updateSportDetailGridData(List<SportDescBean> list) {
    sportDetailGridList.clear();
    sportDetailGridList.addAll(list);
    sportDetailGridList.refresh();
  }
}
